	#
	#  This file implements keyboard functions
	#
	#  Copyright (C) 2006 by Francesco Frigo 
	#
	#  Wednesday 19th July, 2006
	# 
	#  Updated: Wednesday 19th July, 2006
	#

.section .text


	# Read keyboard
.global read_kbd		
read_kbd:
        inb	$0x64,%al	# read status byte
	andb	$0x01,%al	# wait for OBF==1
        jz	read_kbd
	xorl	%eax,%eax	# clear EAX
        inb	$0x60,%al	# read scancode byte
        ret

	# Read keyboard
.global read_kbd_status
read_kbd_status:
	xor	%ax,%ax
        inb	$0x64,%al	# read status byte
	andb	$0x01,%al	# wait for OBF==1
	ret	
	
	# Read keyboard once
.global read_kbd_once
read_kbd_once:
	xorw	%ax,%ax		# clear AX
        inb	$0x60,%al	# read scancode byte
        ret
	
	# Handle keyboard ISR
#.global kbd_int
#kbd_int:
#	cli
#	call	keyboard_isr
#	iret
